package com.cs.common.init.beans;


/**
 * Init system parameter bean 
 * @version 1.0 
 * @date  2008-10-19
 * @author jdelgado
 */

public class SystemParameterBean {
	/** Start to string label */
	private static final String START_TOSTRING_LABEL = "SystemParameterBean -->";
	/** Code label */
	private static final String CODE_LABEL = "Code: ";
	/** Value label */
	private static final String VALUE_LABEL = "; Value: ";
	/** End to string label */
	private static final String END_TOSTRING_LABEL = "<--";
	/** Code  */
	private String code;
	/** Value */
	private String value;
	/**
	 * Gets code
	 * @return code
	 */
	public String getCode() {
		return code;
	}
	/**
	 * Sets code
	 * @param nCode
	 */
	public void setCode(String nCode) {
		this.code = nCode;
	}
	/**
	 * Gets parameter value
	 * @return value field
	 */
	public String getValue() {
		return value;
	}
	/**
	 * Sets parameter value
	 * @param nValue new value
	 */
	public void setValue(String nValue) {
		this.value = nValue;
	}
	/**
	 * Gets int parameter value
	 * @return value field
	 */
	public int getIntValue() {		
		try{
			return Integer.parseInt(value);
		}catch(NumberFormatException e){
			e.printStackTrace();
			return 0;
		}
		
	}
	
	/**
	 * Convert this class to its string representation
	 * @return <String> string representation
	 */
	public String toString(){
		StringBuffer StringBuffer = new StringBuffer(0);
		StringBuffer.append(START_TOSTRING_LABEL);
		StringBuffer.append(CODE_LABEL);
		StringBuffer.append(getCode());
		StringBuffer.append(VALUE_LABEL);
		StringBuffer.append(getValue());
		StringBuffer.append(END_TOSTRING_LABEL);
		return StringBuffer.toString();
	}
}